<%@ page import="com.opensymphony.xwork2.util.ValueStack" %>
<%@ page import="examinee.ExamineeInfo" %>
<%@ page import="java.util.List" %>
<%@ page import="utils.TextUtils" %>
<%@ page import="account.AccountUtils" %>
<%@ page import="utils.Var" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
  <title></title>
  <link href="../../skin/default/global.css" rel="stylesheet" type="text/css"/>
  <link href="../../skin/default/layout.css" rel="stylesheet" type="text/css"/>
  <link href="../../common/jquery-ui-1.7.1.custom.css" rel="stylesheet" type="text/css"/>
    <style>
    html,body{overflow-x:hidden}
    .CheckboxGroup{margin-bottom:-2px;margin-left:-3px;}
     #statlist tr{ cursor:pointer}
    </style>
</head>

<body class="admin-content admin-panel-body">
<%
  if (!AccountUtils.hasRight(session, Var.RIGHT_EXAMINEE_IMPORT | Var.RIGHT_EXAMINEE_MANAGE | Var.RIGHT_EXAMINEE_UPDATE)) throw new Exception("deny!");

  ValueStack vs = (ValueStack) request.getAttribute("struts.valueStack");
  List<ExamineeInfo> list = (List<ExamineeInfo>) vs.findValue("elist");

  int p = (Integer) vs.findValue("page");
  long ps = (Long) vs.findValue("pageSum");
  long sum = (Long) vs.findValue("sum");
%>
<div class="admin-tablenav" style=" margin-bottom:-10px;width:98%">

<div class="admin-tablenav-sum">考生总数：<strong><%=sum%>人</strong></div>
  <%
    if (AccountUtils.hasRight(session, Var.RIGHT_EXAMINEE_MANAGE)) {
  %>
	<button type="button" class="normal" onclick="del()">
    <span></span><img src="../../skin/default/del.gif" style="margin-bottom:-2px"/>删除所选
  </button>
  		
  <button type="button" class="normal" onclick="kswindow.open({title:'添加考生',url:'getExaminee.action',width:'600'})">
    <span></span><img src="../../skin/default/add.gif"/>添加考生
  </button>
  <%
    }
  %>
  <%--<button type="button" onclick="KS.print('print.jsp')" class="normal"><span></span><img src="../../skin/default/print.gif"/>打印列表</button>--%>

</div>

<!--成绩列表-->
<table cellpadding="0" cellspacing="0" class="admin-table" style="width:98%">
  <thead>
    <tr>
      <%
        if (AccountUtils.hasRight(session, Var.RIGHT_EXAMINEE_MANAGE)) {
      %>
      <th style="width:30px"><span class="first"></span><input type="checkbox" style="margin-bottom:-2px;margin-left:3px;" id="checkall" /></th>
      <%
        }
      %>
      <th style="width:28px">成绩</th>
      <th>准考证号</th>
      <th style="width:80px">培训机构</th>
      <th style="width:80px">身份证号</th>
      <th style="width:40px">姓名</th>
      <th style="width:30px">性别</th>
      <th style="width:80px">驾驶证号</th>
      <th style="width:30px">车型</th>
      <th style="width:60px">报考科目</th>
      <th style="width:60px;" class="last">考试日期</th>
    </tr>
  </thead>

  <tbody id="statlist">
    <%
      if(list.size() == 0){
    %>
    <tr>
      <td colspan="11" class="first last">
        <div class="notice">查询结果为空</div>
      </td>
    </tr>
    <%
      }

      boolean isCanUpdate = AccountUtils.hasRight(session, Var.RIGHT_EXAMINEE_UPDATE);
      for (ExamineeInfo info : list) {
    %>
      <tr <%if(isCanUpdate){%>onclick="kswindow.open({title:'修改考生信息',url:'getExaminee.action?eid=<%=info.getEid()%>',width:'600'})"<%}%>>
        <%
          if (AccountUtils.hasRight(session, Var.RIGHT_EXAMINEE_MANAGE)) {
        %>
      <td class="first"><input type="checkbox" name="<%=info.getEid()%>" class="CheckboxGroup"/></td>
        <%
          }
        %>
      <td>&nbsp;</td>
      <td><%=info.getZkzh()==null?"":info.getZkzh()%>&nbsp;</td>
      <td><%=info.getPxjg()==null?"":info.getPxjg()%>&nbsp;</td>
      <td><%=info.getSfzh()==null?"":info.getSfzh()%>&nbsp;</td>
      <td><%=info.getEname()==null?"":info.getEname()%>&nbsp;</td>
      <td><%=info.getGender()==1?"男":"女"%>&nbsp;</td>
      <td><%=info.getJszh()==null?"":info.getJszh()%>&nbsp;</td>
      <td><%=info.getZjcx()==null?"":info.getZjcx()%>&nbsp;</td>
      <td><%=info.getKskm()==null?"":info.getKskm()%>&nbsp;</td>
      <td class="last"><%=info.getKsrq()==0? "":TextUtils.GetShowDate(info.getKsrq())%>
      </td>
    </tr>
    <%
      }
    %>
    <tfoot>
      <tr>
        <td colspan="11" class="last"><span class="first"></span>
          <a href="getExaminees.action">首页</a>
          | <a href="<%=p==1?"#":"getExaminees.action?page="+(p-1)%>">上一页</a>
          | <a href="<%=p==ps?"#":"getExaminees.action?page="+(p+1)%>">下一页</a>
          | <a href="getExaminees.action?page=<%=ps%>">末页</a>
          <select onchange="location.href='getExaminees.action?page='+this.value">
            <%
              for (int i = 1; i <= ps; i++) {
            %>
            <option value="<%=i%>" <%=p == i ? "selected":""%>><%=i%></option>
            <%
              }
            %>
          </select>
        </td>
      </tr>
    </tfoot>


  </tbody>
</table>
<iframe name="execute" id="execute" src="" width="0" height="0"></iframe>

<script src="../../common/jquery-1.3.2.min.js"></script>
<script src="../../common/jquery.blockUI.js"></script>
<script src="../../common/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="../../common/fun.js"></script>
<script>
  $(function() {
    list = new KS.List("statlist", true)
    kswindow = new KS.Window();
    $("#checkall").click(function(){
    		if($(this).attr("checked")){
    			$(".CheckboxGroup").attr("checked",true)
    		}
    		else{
    			$(".CheckboxGroup").attr("checked",false)
    		}
    	})
    $(".CheckboxGroup").click(function(){
    		window.event.cancelBubble = true
    		$("#checkall").attr("checked",false)
    	})
  })
  function del(){
  	var returnID = [];
  	$(".CheckboxGroup").each(function(){
  			if($(this).attr("checked")==true){
  				returnID.push($(this).attr("name"));
  			}
  		})
  if(window.confirm("你确定要删除所选考生吗？")){
  		$("#execute").attr("src","delExaminees.action?delIds="+returnID.toString())
  }
  }
</script>

</body>

</html>